package com.taogewan.imagedemo.imageloader;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.widget.ImageView;

import com.taogewan.imagedemo.picasso.Picasso;

public class ImageLoaderImp implements ImageLoader {
    @Override
    public void load(Context context, String imageUrl, ImageView imageView) {
        if (context != null && imageView != null && !TextUtils.isEmpty(imageUrl)) {
            if (context instanceof Activity && ((Activity) context).isFinishing()) {
                return;
            }
            try {
                Picasso.with(context).load(imageUrl).into(imageView);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
